package com.informatics.polymer.server;

import org.restlet.Application;
import org.restlet.Directory;
import org.restlet.Restlet;
import org.restlet.Router;

import com.informatics.polymer.server.browserepository.AddingRepeatUnit;
import com.informatics.polymer.server.browserepository.DatabaseResource;
import com.informatics.polymer.server.browserepository.ViewRepository;
import com.informatics.polymer.server.opsin.NameToStructureConversionResource;
import com.informatics.polymer.server.opsin.OpsinSubstructureSearchResource;
import com.informatics.polymer.server.propertysearch.PropertySearchResource;
import com.informatics.polymer.server.substructureSearch.SubstructureSearch;

public class BuilderApplication extends Application {
	/**
	 * Creates a root restlet that will recieve all incoming calls.
	 */
	@Override
	public Restlet createRoot(){
		//Define attachments
		Router router = new Router(getContext().createChildContext());
		router.attach("/homopolymer",HomopolymerBuilder.class);  //new Directory(getContext(), "clap://thread/com/informatics/polymer/com.informatics.polymer.HomopolymerBuilder"));
		router.attach("/blockCopolymer",BlockCopolymerBuilder.class);
		router.attach("/alternatingCopolymer",AlternatingCopolymerBuilder.class);
		router.attach("/graftCopolymer",GraftCopolymerBuilder.class);
		router.attach("/dendrimer",DendrimerBuilder.class);
		router.attach("/randomCopolymer",RandomCopolymerBuilder.class);
		router.attach("/repeatUnitAddition",AddingRepeatUnit.class);
		router.attach("/substructuresearch/{id}",SubstructureSearch.class);
		router.attach("/viewRepository",ViewRepository.class);
		router.attach("/databaseData",DatabaseResource.class);
		router.attach("/propertySearch",PropertySearchResource.class);
		router.attach("/nameToStructure",NameToStructureConversionResource.class);
		router.attach("/opsinsubstructuresearch",OpsinSubstructureSearchResource.class);
		router.attach("/owl2xml",OWLToXMLConverterResource.class);
		return router;
	}
}
